﻿using System;
using System.Diagnostics;
using System.Web.Mvc;

using StructureMap;

namespace Mvc.XForms.Examples.Controllers {
	public class StructureMapControllerFactory : DefaultControllerFactory {
		protected override IController GetControllerInstance(Type controllerType) {
			try {
				return ObjectFactory.GetInstance(controllerType) as Controller;
			}
			catch (StructureMapException ex) {
				Debug.WriteLine(ObjectFactory.WhatDoIHave());
				throw ex;
			}
		}
	}
}